using System;
using System.Collections.Generic;
using System.Linq;

namespace EnvRide.Core.ObjectModel
{
    /// <summary>
    /// List of Environments.
    /// </summary>
    [Serializable]
    public class EnvironmentCollection : List<Environment>
    {
        public Environment this[string envName]
        {
            get
            {
                if (String.IsNullOrEmpty(envName))
                    throw new ArgumentNullException("envName");

                return this.SingleOrDefault(inEnv => inEnv.Name.Equals(envName));
            }
        }
    }
}